<?php
/**
 * Created by 784855684@qq.com.
 * Link: https://github.com/lichtung/wshore
 * User: linzh
 * Date: 7/11/17
 * Time: 10:08 AM
 */
declare(strict_types=1);


namespace application\module\admin\controller;


use wshore\core\Response;
use application\module\admin\addon\Rbca as A;

class reflect extends admin
{

    public function index()
    {
        $this->doLayoutAssign();
        $this->display();
    }

    /**
     * @return void
     */
    public function getlist()
    {
        $list = A::getInstance()->scan(WS_PATH_APP . 'module/admin/', false);
        Response::success('OK', $list);
    }

    /**
     * TODO:反馈新增加多少记录
     * @param int $response
     * @return array
     */
    public function refresh(int $response = 1)
    {
        $list = A::getInstance()->scan(WS_PATH_APP . 'module/admin/', true);
        $response > 0 and Response::success('OK', $list);
        return $list;
    }

    /**
     * URL:admin/reflect/updatecomment
     * @param int $id
     * @param string $comment
     * @return void
     */
    public function updateComment(int $id, string $comment)
    {
        $addon = A::getInstance();
        if ($addon->updateComment($id, $comment)) {
            Response::success('修改成功');
        } else {
            Response::failure('修改失败:' . $addon->getError());
        }
    }

}